/**
 * <p>
 * 表格配置
 *
 * @Author：Roy
 * @Description：设备管理
 * @Date：Create by 2023-11-30 18:51:39
 */
// 隐藏操作按钮的规则配置，字段名：isEdit
const isHidden = (list, row) => {
  const { isEdit } = row || {}
  return list.includes(String(isEdit))
}

const headerConfig = {
  'deviceWarning': [
    {
      prop: 'id',
      name: '编号',
      minWidth: 110
    },
    {
      prop: 'warningName',
      name: '预警名称',
      minWidth: 110
    },
    {
      prop: 'projectName',
      name: '所属项目',
      minWidth: 110
    },
    {
      prop: 'sceneInfoName',
      name: '所属场景',
      minWidth: 150
    },
    {
      prop: 'thresholdLevelName',
      name: '预警等级',
      minWidth: 200
    },
    {
      name: '生效时间',
      minWidth: 160,
      formatter(row, column, cell, index) {
        return row.startTime + '~' + row.endTime
      }
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '编辑',
          id: 'deviceWarning-edit',
          authId: 'ecp-admin:deviceWarning:update',
          config: { type: 'text' },
          style: { color: 'rgb(219,139,57)' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        }, {
          type: 'btnText',
          label: '详情',
          id: 'deviceWarning-detail',
          authId: 'ecp-admin:deviceWarning:detail',
          config: { type: 'text' },
          style: { color: 'rgb(219,139,57)' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '删除',
          id: 'deviceWarning-delete',
          authId: 'ecp-admin:deviceWarning:deleteById',
          isMore: true,
          config: { type: 'text' },
          style: { color: '#ff0000' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
